/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package protocolHandler;

/**
 *
 * @author Александр Емельянов (mr.lex91@gmail.com)
 */
public class ProtoMessageCreator extends ProtoHandler{
    public String Create()
    {
        return Create(this);
    }
    public static String Create(ProtoHandler handler)
    {
        String msg=handler.getType();
        if (msg.equalsIgnoreCase("CreateAcc") || msg.equalsIgnoreCase("DeleteAcc") || msg.equalsIgnoreCase("LogIn"))
            msg+="\nNickName: "+handler.getHeaderVal("NickName")+"\nPassword: "+handler.getHeaderVal("Password");
        else if (msg.equalsIgnoreCase("Send") || msg.equalsIgnoreCase("Message") || msg.equalsIgnoreCase("SendTo") || msg.equalsIgnoreCase("MsgFrom"))
            msg+="\nAddress: "+handler.getHeaderVal("Address")+"\nSize: "+handler.getHeaderVal("Size")+"\nText: "+handler.getHeaderVal("Text");
        else if (msg.equalsIgnoreCase("ConnectParams"))
            msg+="\nHost: "+handler.getHeaderVal("Host")+"\nPort: "+handler.getHeaderVal("Port");
        else if(msg.equalsIgnoreCase("SendFile") || msg.equalsIgnoreCase("ReceiveFile"))
            msg+="\nAddress: "+handler.getHeaderVal("Address")+"\nHost: "+handler.getHeaderVal("Host")+"\nPort: "
                    +handler.getHeaderVal("Port")+"\nFileName: "+handler.getHeaderVal("FileName")+"\nFileRequest: "+handler.getHeaderVal("FileRequest")
		    +"\nFileSize: "+handler.getHeaderVal("FileSize");
        return msg;
    }
}
